<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p1 = new Promise((resolve,reject)=>{
            try{
                console.log('开始获取a');
                // throw new Error('又错啦')
                setTimeout(() => {
                    console.log('获取成功');
                    resolve('成功啦')

                }, 2000);
            }catch(e){
                reject('失败')
            }

        })
        p1.then(value=>{

        })
        const p2 = p1.catch(reason =>{
            return new Promise((resolve,reject)=>{
                resolve('成功')
            })
        })
        console.log("p2", p2);
    </script>
</body>
</html>